Try our conversational search powered by Generative AI!

PageTree menu structure, not all levels visible, only the two first until clicked

Vote:
 
Hello all. I've got this code used to display a left menu on a testsite i've done: <%@ control language="C#" autoeventwireup="true" codebehind="LeftMenu.ascx.cs" inherits="testSite.Web.templates.Controls.LeftMenu" %> <%@ register tagprefix="EPiServer" namespace="EPiServer.WebControls" assembly="EPiServer" %>
<%# rendermenuitem(container.currentpage)%>
And the code behind looks like this: namespace testSite.Web.templates.Controls { public partial class LeftMenu : Classes.testSiteUserControlBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PageTreeControl.PageLink = new PageReference(TopMenuLevelId); PageTreeControl.DataBind(); } } public string RenderMenuItem(PageData pd) { if (pd.Property["MenuImage"].ToString().Length > 0) return String.Format("\", pd.Property["MenuImage"], pd.PageName); return String.Format("{1}", pd.LinkURL, pd.PageName); } } What I want to do is do show the FIRST two levels in the pagetree. If not klicked. Otherwise I want to expand the rest. Right now it displays all of the levels. And if I set ExpandAll="true" then all of the levels in the menu are displayed. I just want to display the first 2 levels. Anyone know how to do that? Kind regards, -- Jon
#13236
Oct 16, 2007 14:27
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.